package com.wanmait.zaisousuo.webcontroller;


import com.wanmait.zaisousuo.service.TextureService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
@RequestMapping("/web/texture")
public class TextureWebController {

    @Resource
    private TextureService textureService;

    //根据父类材质id查询出所有子类材质
    @RequestMapping("childrenTextures")
    public ModelAndView childrenTextures(Integer textId,String textName){
        ModelAndView mv = new ModelAndView();
        mv.addObject("childrenTextures",textureService.findChildrenTexture(textId));
        mv.setViewName("/web/article/childrenTextures");
        return mv;
    }

    //ajax:根据父类材质id查询出所有子类材质
    @RequestMapping("childrenTextures2")
    public ModelAndView childrenTextures2(Integer texture){
        ModelAndView mv = new ModelAndView();
        mv.addObject("childrenTextures",textureService.findChildrenTexture(texture));
        mv.setViewName("/web/article/childrenTextures2");
        return mv;
    }

}
